import axios from '@/libs/api.request'
import platform from '@/config/platform'
/**
 * @param { 固定车辆管理 }
 */
// 修改
/**
 * @param { 类别管理 }
 */
// 添加类别
export const addCate = data => {
  return axios.request({
    url: platform.BOOKING + '/fixed-car/type',
    method: 'post',
    data
  })
}
// 编辑类别
export const editCate = data => {
  return axios.request({
    url: platform.BOOKING + '/fixed-car/type',
    method: 'put',
    data
  })
}
// 查看类别
export const lookCateDetails = id => {
  return axios.request({
    url: platform.BOOKING + `/fixed-car/type/${id}`,
    method: 'get'
  })
}
/**
     * @param { 车辆申请 }
     */
// 获取所属类别
export const getCateList = () => {
  return axios.request({
    url: platform.BOOKING + `/fixed-car/type/list`,
    method: 'get'
  })
}
// 添加车辆申请
export const addApply = data => {
  return axios.request({
    url: platform.BOOKING + '/fixed-car/apply',
    method: 'post',
    data
  })
}
// 编辑车辆申请
export const editApply = data => {
  return axios.request({
    url: platform.BOOKING + '/fixed-car',
    method: 'put',
    data
  })
}
// 查看车辆申请详情
export const lookApplyDetails = id => {
  return axios.request({
    url: platform.BOOKING + `/fixed-car/detail/${id}`,
    method: 'get'
  })
}
// 查询检查站
export const getStation = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/area/list`,
    method: 'get',
    params
  })
}
/**
     * @param { 车辆审核 }
     */
export const doExamine = data => {
  return axios.request({
    url: platform.BOOKING + '/fixed-car/audit-record/audit',
    method: 'post',
    data
  })
}
// 社区开单审核
export const billingAudit = data => {
  return axios.request({
    url: platform.BOOKING + '/bookingCar/audit',
    method: 'post',
    data
  })
}
// 社区开单审核批量
export const billingAuditAll = data => {
  return axios.request({
    url: platform.BOOKING + '/bookingCar/audit-batch',
    method: 'post',
    data
  })
}
// 批量审核通过/拒绝
export const doMulExamine = data => {
  return axios.request({
    url: platform.BOOKING + '/fixed-car/audit-record/batchAudit',
    method: 'post',
    data
  })
}
// 社区开单数据概览
export const getInfoOverview = params => {
  return axios.request({
    url: platform.BOOKING + '/bookingCar/shequkaidan-count',
    method: 'get',
    params
  })
}

/**
 * @param { 预约车辆管理 }
 */
/**
 * @param { 类别管理 }
 */
// 添加类别
export const addCates = data => {
  return axios.request({
    url: platform.BOOKING + '/booking-car/type',
    method: 'post',
    data
  })
}
// 编辑类别
export const editCates = data => {
  return axios.request({
    url: platform.BOOKING + '/booking-car/type',
    method: 'put',
    data
  })
}
// 查看类别
export const lookCatesDetails = id => {
  return axios.request({
    url: platform.BOOKING + `/booking-car/type/${id}`,
    method: 'get'
  })
}
/**
     * @param { 事由管理 }
     */
// 添加类别
export const addReason = data => {
  return axios.request({
    url: platform.BOOKING + '/incident-origin',
    method: 'post',
    data
  })
}
// 编辑类别
export const editReason = data => {
  return axios.request({
    url: platform.BOOKING + '/incident-origin',
    method: 'put',
    data
  })
}
// 查看类别
export const lookReasonDetails = id => {
  return axios.request({
    url: platform.BOOKING + `/incident-origin/${id}`,
    method: 'get'
  })
}
/**
     * @param { 停车场管理 }
     */
// 添加类别
export const addParking = data => {
  return axios.request({
    url: platform.BOOKING + '/parking-lot',
    method: 'post',
    data
  })
}
// 编辑类别
export const editParking = data => {
  return axios.request({
    url: platform.BOOKING + '/parking-lot',
    method: 'put',
    data
  })
}
// 查看类别
export const lookParkingDetails = id => {
  return axios.request({
    url: platform.BOOKING + `/parking-lot/${id}`,
    method: 'get'
  })
}
/**
     * @param { 车辆申请 }
     */
// 获取通行检查站列表
export const getCheckPointList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/getCheckpointList`,
    method: 'get',
    params
  })
}
// 获取配额展示数据
export const getNumber = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/quotaNumData`,
    method: 'get',
    params
  })
}
// 获取日期
export const getDate = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/getOne`,
    method: 'get',
    params
  })
}
// 获取预约时段
export const getInterval = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/timeInterval`,
    method: 'get',
    params
  })
}
// 获取社区预约时段
export const getInterval_shequ = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/timeInterval-shequ`,
    method: 'get',
    params
  })
}
// 获取车辆类型
export const getCarType = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/bookingCarType`,
    method: 'get',
    params
  })
}
// 获取目的地列表
export const getDestList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/destination`,
    method: 'get',
    params
  })
}
// 获取社区开单业务去除两级后的目的地列表
export const getDestList_new = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/destination-shequ`,
    method: 'get',
    params
  })
}
// 获取事由列表
export const getOriginList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/incidentOrigin`,
    method: 'get',
    params
  })
}
// 获取停车场列表
export const getParkingList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/parkingLot`,
    method: 'get',
    params
  })
}
// 添加车辆申请
export const addApplys = data => {
  return axios.request({
    url: platform.BOOKING_WWX + '/bookingOrderCreate/createBookingOrder',
    method: 'post',
    data
  })
}
// 社区开单
export const communityBilling = data => {
  return axios.request({
    url: platform.BOOKING_WWX + '/bookingOrderCreate/createBookingOrder-shequ',
    method: 'post',
    data
  })
}
// // 获取审核信息
export const getVertifyList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/getCheckpointAuditOrg`,
    method: 'get',
    params
  })
}
// 获取审核信息是否纸质
export const getIsPar = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingOrderCreate/getCheckpointConfig`,
    method: 'get',
    params
  })
}
/**
     * @param { 通行单管理 }
     */
// 保存通行单配置
export const addTicket = data => {
  return axios.request({
    url: platform.BOOKING_WWX + '/booking-config',
    method: 'post',
    data
  })
}
// 获取通行单配置回显
export const getTicket = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/booking-config/getOne`,
    method: 'get',
    params
  })
}
// 获取检查站回显
export const getStationList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/booking-config/print-time-config/list`,
    method: 'get',
    params
  })
}

// 获取打印模板列表
export const getPrintList = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/print-temp/list`,
    method: 'get',
    params: {
      status: 1,
      ...params
    }
  })
}

// 获取打印模板明细
export const getPrintDetail = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/print-temp-detail/page`,
    method: 'get',
    params
  })
}
// 获取打印模板信息
export const getPrintInfo = params => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingCar/print`,
    method: 'get',
    params
  })
}

/**
 * @param { 车辆查看 }
 */
// 车辆详情查看
export const lookCarTypeDetails = id => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingCar/${id}`,
    method: 'get'
  })
}
// 车辆取消
export const doCancel = (val) => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingCar/cancel/${val.id}`,
    method: 'post',
    params: val.params
  })
}
// 车辆作废
export const doRepeal = (val) => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingCar/repeal/${val.id}`,
    method: 'post',
    data:val.data,
  })
}
/**
     * @param { 车辆审核 }
     */
// 审核
export const doVertify = data => {
  return axios.request({
    url: platform.BOOKING_WWX + `/bookingCar/audit`,
    method: 'post',
    data
  })
}
// 查看类别管理
export const lookCateList = params => {
  return axios.request({
    url: platform.BOOKING + '/booking-car/type/list',
    method: 'get',
    params

  })
}
// 记录打印次数
export const printRecord = id => {
  return axios.request({
    url: platform.BOOKING + '/bookingCar/print-log/create',
    method: 'get',
    params: {
      bookingCarId: id
    }
  })
}
// 校验打印资格
export const checkPrint = id => {
  return axios.request({
    url: platform.BOOKING + '/bookingCar/printValid',
    method: 'get',
    params: {
      bookingCarId: id
    }
  })
}

/**
 * @param { 批量导入 }
 */
// 下载模板
export const downloadModel = (params) => {
  return axios.request({
    url: platform.BOOKING + `/fixed-car/download-template-fixedcar`,
    method: 'get',
    params,
    responseType: 'blob'

  })
}
// 导入
export const leading = data => {
  return axios.request({
    url: platform.BOOKING + `/fixed-car/import-fixedcar`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
